function vmd_view
%
%  Write images of total density distribution df(z,v) for different x. 
%  Write an image of the spectum of first stream density for one slice.
%

kz = 0.35;
vphase =  3.37;
vmax   = 10;

fname1 = 'test_vmd.dfu.0001.00';  fname2 = 'test_vmd.dfu.0001.01';  jx=4; jz=32; jv=256;
				   
%---------------------------------------------------------

  iunit = i;

  nz=1;
  dkz = kz/nz;
  dz = 2*pi*nz/(jz*kz);
  z  = (0:jz-1)*dz;
  Lz = 2*pi/kz;
 
  dp = 2*pi/(2*vmax);
  p  = fftshift([-jv/2:jv/2-1],2)*dp;
  kz = fftshift([-jz/2:jz/2-1],2)*dkz;

  dv=2*vmax/jv;  v = (0:jv-1)*dv - vmax;
 
  f0 = ( 1/sqrt(2*pi) )*exp( - 0.5*v.^2 );


  %---------------------------------------------------------

  fid = fopen(fname1, 'rb');  dfu = fread(fid, jv*jz*jx, 'double');  fclose(fid);
  dfu1 = reshape(dfu, jv,jz,jx);

  fid = fopen(fname2, 'rb');  dfu = fread(fid, jv*jz*jx, 'double');  fclose(fid);
  dfu2 = reshape(dfu, jv,jz,jx);

  dfu = dfu1 + dfu2;

  fmax=max(max(max(dfu)));  fmin = -fmax;

  f1 = squeeze(dfu(jv/2+1:jv*3/4,:,1)); 
  % figure(1); imagesc(flipud(f1),[fmin,fmax]); axis('equal', 'off');
  one_image(f1, fmin, fmax, 'slice1.png')

  f2 = squeeze(dfu(jv/2+1:jv*3/4,:,2)); 
  % figure(2); imagesc(flipud(f2),[fmin,fmax]); axis('equal', 'off');
  one_image(f2, fmin, fmax, 'slice2.png')

  f3 = squeeze(dfu(jv/2+1:jv*3/4,:,3)); 
  % figure(3); imagesc(flipud(f3),[fmin,fmax]); axis('equal', 'off');
  one_image(f3, fmin, fmax, 'slice3.png')

  f4 = squeeze(dfu(jv/2+1:jv*3/4,:,4)); 
  % figure(4); imagesc(flipud(f4),[fmin,fmax]); axis('equal', 'off');
  one_image(f4, fmin, fmax, 'slice4.png')

  ff1 = fftshift(log(abs(fftn(f1))));
  ffmin=min(min(ff1)); ffmax=max(max(ff1));
  % figure(5); imagesc(fftshift(log(ff1)))
  one_image(ff1, ffmin, ffmax, 'spectrum.png')


  %---------------------------------------------------------

end
